package cc.linker.steplink.crm.merchant.controller;

import cc.linker.steplink.crm.merchanth5.service.acs.ProtectRecordService;
import cc.linker.steplink.crm.merchant.service.RefundService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/refund")
public class RefundController {

    @Autowired
    private RefundService refundService;

    @Autowired
    private ProtectRecordService ProtectRecordService;


    /**
     * @Description: 用户维权页
     * @param: protectCode 维权编号
     * @Return: Object
     * @Author: ch
     * @Date: 2020/02/11 14:48
     * @Version: 1.11.10
     **/
    @PostMapping("/protectInfo")
    public Object protectInfo(@RequestBody Map<String, Object> params) {
        return refundService.getProtectInfo(params);
    }

    /**
     * @Description: 用户维权页协商列表
     * @param: protectCode 维权编号
     * @Return: Object
     * @Author: ch
     * @Date: 2020/02/12 09:48
     * @Version: 1.11.10
     **/
    @PostMapping("/consultList")
    public Object consultList(@RequestBody Map<String, Object> params) {
        return refundService.getConsultList(params);
    }


    /**
     * @Description: 用户维权操作
     * @param: protectCode 维权编号
     * @param: refundStatus 退款状态
     * @param: reasonContent 拒绝原因
     * @param: recId 订单商品表id
     * @Return: void
     * @Author: ch
     * @Date: 2020/02/12 14:48
     * @Version: 1.11.10
     **/
    @PostMapping("/updateStatus")
    public void updateStatus(@RequestBody Map<String, Object> params) {
         refundService.updateStatus(params);
    }

    /**
     * @Description: 用户维权留言
     * @param: protectCode 维权编号
     * @param: consultStatus 状态
     * @param: consultContent 内容
     * @param: consultImages 图片
     * @param: recId 订单商品表id
     * @Return: void
     * @Author: ch
     * @Date: 2020/02/12 15:48
     * @Version: 1.11.10
     **/
    @PostMapping("/addConsult")
    public void addConsult(@RequestBody Map<String, Object> params) {
        params.put("consultStatus","卖家留言");
        refundService.addConsult(params);
    }

    @PostMapping("/getPurchaseInfo")
    public void getPurchaseInfo(String orderSn) {
        Map<String,String>  purchaseMap = refundService.getPurchaseInfo(orderSn);
    }

}
